package net.sansi.v3correctserver.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sansi.v3correctserver.dto.R;
import net.sansi.v3correctserver.entity.screen.ScanBoard;
import net.sansi.v3correctserver.entity.screen.Screen;
import net.sansi.v3correctserver.service.screen.ScreenService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * Created by Fang
 * create time : 2024/11/4
 * IDE : IntelliJ IDEA
 * <p>
 * 屏幕相关接口
 */
@Api(tags = "屏幕相关接口")
@RestController
@RequestMapping("/screen")
@Validated
public class ScreenController {

    @Resource
    private ScreenService screenService;

    /**
     * 显示屏幕列表
     *
     * @return 屏幕列表
     */
    @ApiOperation("显示屏幕列表")
    @GetMapping("/list")
    public R<List<Screen>> list() {
        return R.data(screenService.list());
    }

    /**
     * 扫描板（机箱）列表，带所有面板
     *
     * @param screenId 屏幕ID
     * @return 扫描板（机箱）列表，带所有面板
     */
    @ApiOperation("扫描板（机箱）列表，带所有面板")
    @GetMapping("/scan-boards")
    public R<List<ScanBoard>> scanBoards(@RequestParam("screenId") @NotBlank String screenId) {
        return R.data(screenService.scanBoards(screenId));
    }
}
